/**
 */
package DentalClinicEMF.clinic.impl;

import DentalClinicEMF.clinic.Client;
import DentalClinicEMF.clinic.ClinicPackage;
import DentalClinicEMF.clinic.DentalClinic;
import DentalClinicEMF.clinic.Dentist;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Dental Clinic</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link DentalClinicEMF.clinic.impl.DentalClinicImpl#getEReference0 <em>EReference0</em>}</li>
 *   <li>{@link DentalClinicEMF.clinic.impl.DentalClinicImpl#getClientList <em>Client List</em>}</li>
 *   <li>{@link DentalClinicEMF.clinic.impl.DentalClinicImpl#getDentistList <em>Dentist List</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DentalClinicImpl extends MinimalEObjectImpl.Container implements DentalClinic {
	/**
	 * The cached value of the '{@link #getEReference0() <em>EReference0</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference0()
	 * @generated
	 * @ordered
	 */
	protected DentalClinic eReference0;

	/**
	 * The cached value of the '{@link #getClientList() <em>Client List</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClientList()
	 * @generated
	 * @ordered
	 */
	protected EList clientList;

	/**
	 * The cached value of the '{@link #getDentistList() <em>Dentist List</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDentistList()
	 * @generated
	 * @ordered
	 */
	protected EList dentistList;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DentalClinicImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return ClinicPackage.Literals.DENTAL_CLINIC;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DentalClinic getEReference0() {
		if (eReference0 != null && eReference0.eIsProxy()) {
			InternalEObject oldEReference0 = (InternalEObject)eReference0;
			eReference0 = (DentalClinic)eResolveProxy(oldEReference0);
			if (eReference0 != oldEReference0) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ClinicPackage.DENTAL_CLINIC__EREFERENCE0, oldEReference0, eReference0));
			}
		}
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DentalClinic basicGetEReference0() {
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference0(DentalClinic newEReference0) {
		DentalClinic oldEReference0 = eReference0;
		eReference0 = newEReference0;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ClinicPackage.DENTAL_CLINIC__EREFERENCE0, oldEReference0, eReference0));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getClientList() {
		if (clientList == null) {
			clientList = new EObjectContainmentEList(Client.class, this, ClinicPackage.DENTAL_CLINIC__CLIENT_LIST);
		}
		return clientList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getDentistList() {
		if (dentistList == null) {
			dentistList = new EObjectContainmentEList(Dentist.class, this, ClinicPackage.DENTAL_CLINIC__DENTIST_LIST);
		}
		return dentistList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Dentist getDentist(String name) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Client getClient(String name) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ClinicPackage.DENTAL_CLINIC__CLIENT_LIST:
				return ((InternalEList)getClientList()).basicRemove(otherEnd, msgs);
			case ClinicPackage.DENTAL_CLINIC__DENTIST_LIST:
				return ((InternalEList)getDentistList()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ClinicPackage.DENTAL_CLINIC__EREFERENCE0:
				if (resolve) return getEReference0();
				return basicGetEReference0();
			case ClinicPackage.DENTAL_CLINIC__CLIENT_LIST:
				return getClientList();
			case ClinicPackage.DENTAL_CLINIC__DENTIST_LIST:
				return getDentistList();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ClinicPackage.DENTAL_CLINIC__EREFERENCE0:
				setEReference0((DentalClinic)newValue);
				return;
			case ClinicPackage.DENTAL_CLINIC__CLIENT_LIST:
				getClientList().clear();
				getClientList().addAll((Collection)newValue);
				return;
			case ClinicPackage.DENTAL_CLINIC__DENTIST_LIST:
				getDentistList().clear();
				getDentistList().addAll((Collection)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case ClinicPackage.DENTAL_CLINIC__EREFERENCE0:
				setEReference0((DentalClinic)null);
				return;
			case ClinicPackage.DENTAL_CLINIC__CLIENT_LIST:
				getClientList().clear();
				return;
			case ClinicPackage.DENTAL_CLINIC__DENTIST_LIST:
				getDentistList().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ClinicPackage.DENTAL_CLINIC__EREFERENCE0:
				return eReference0 != null;
			case ClinicPackage.DENTAL_CLINIC__CLIENT_LIST:
				return clientList != null && !clientList.isEmpty();
			case ClinicPackage.DENTAL_CLINIC__DENTIST_LIST:
				return dentistList != null && !dentistList.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //DentalClinicImpl
